﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ClusterGui
{
    

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //treeView1.ch
           tbLogger my_tbLogger = new tbLogger(tbLog);
           treeView1.ShowNodeToolTips = true;
            //textBox1.Text += "eeee.....\n";
            tbLog.Refresh();
            GateExtractor.Processor my_processor = new GateExtractor.Processor(my_tbLogger);
            my_processor.Process();
            tbLog.Text += "done!\n";
            foreach (GateExtractor.Cluster cluster in my_processor.clusters)
            {
                treeView1.Nodes.Add(cluster.treeNode);
            }

///            TreeNode node;
            
   //         node = treeView1.Nodes.Add("Fruits");
     //       node.ToolTipText = "lalala";
       //     node.Nodes.Add("Apple");
         //   node.Nodes.Add("Peach");

           // node = treeView1.Nodes.Add("Vegetables");
            //node.Nodes.Add("Tomato");
            //node.Nodes.Add("Eggplant");
        }
    }
    class tbLogger : GateExtractor.ILogger
    {
        TextBox tb;
        public tbLogger(TextBox _tb)
        {
            tb = _tb;
        }
        public void WriteLine(string str)
        {
            //  Form1.text
            tb.Text += str+"\n";
            tb.Refresh();
        }
        public void Write(string str)
        {
            //  Form1.text
        }
    }
}
